package com.nlp.visualization.core.discourse.impl;

import com.nlp.visualization.core.discourse.ISensitiveService;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * @author LXM
 * @Title: SensitiveServiceImpl
 * @Description: 敏感词过滤以及识别的实现类
 * @date 2018/2/24下午7:26
 */
@Service
public class SensitiveServiceImpl implements ISensitiveService {

    private static SensitivewordFilter filter = new SensitivewordFilter();

    @Override
    public Set sensitiveWords(String text, int matchType) {
        //启用DFA过滤
        Set<String> set = filter.getSensitiveWord(text, matchType);
        return set;
    }

    @Override
    public String replaceSensitiveWords(String text, int matchType, String replaceChar) {

        return filter.replaceSensitiveWord(text, matchType, replaceChar);
    }
}
